package com.zyh.config;

import com.zyh.interceptor.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration//该类是一个配置类
public class MyInterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //添加MyInterceptor到注册机里面，该拦截器拦截所有的请求，排除掉/anime/*的请求
        registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**").excludePathPatterns("/pet/upload");
    }
}
